<?php 

class User_IndexController extends Zend_Controller_Action
{
	public function listAction()
	{
		$entities = Account_Model_Account::getNewests();

		$entList = array();

		foreach ($entities as $ent) {

			$e = new stdClass();

			$e->id = $ent->getId();
			$e->idname = $ent->getIdName();
			$e->nicename = $ent->getNiceName();
			$e->url = site_url_base($ent->getUrl());

			if (Kernel::getInstance()->isModuleActive('profile')) {
				$profile = Profile_Model_Data::getInstance('user', $ent->getId());
				if ($profile != NULL) {
					$e->brief = $profile->get('status');
				} else {
					$e->brief = '';
				}
				$e->avatarUrl = Profile_Model_Avatar::getFileUrl('user', $ent->getId());
			} else {
				$e->brief = NULL;
				$e->avatarUrl = NULL;
			}

			$entList[] = $e;
		}

		$this->view->entityList = $entList;
		$this->view->entityCount = count($entList);
	}
}